package com.shixi.util;

import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;

public class GetTime {
    public static String getTime() {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");//设置日期格式
        return dateFormat.format(new Date());
    }

    public static Date getDate(String time) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        ParsePosition position = new ParsePosition(0);
        return dateFormat.parse(time, position);
    }
}
